# -*- coding: utf-8 -*-
# @Time : 2024/1/22 23:21
# @Author : cute
# @Email : Aggressive_cute@126.com

import time
import requests
from loguru import logger


def dumps(data_dict):
    """
    字典数据序列化
    :return:
    """
    import json
    return json.dumps(data_dict, separators=(',', ':'))


url = "http://203.57.239.243:9000/cute_api/jd_api/get_h5st_now"
params = {
    "appid": "pc-item-soa",
    "body": dumps(
        {"skuId": 100078020150, "cat": "9987,653,655", "area": "15_1213_3038_59931", "shopId": "1000004123",
         "venderId": 1000004123,
         "paramJson": dumps(
             {"platform2": "1", "specialAttrStr": "p0pppppppp2pp1p1pppppppppppppp", "skuMarkStr": "00"}),
         "num": 1,
         "bbTraffic": "",
         "canvasType": 1}),
    "client": "pc",
    "clientVersion": "1.0.0",
    "functionId": "pc_detailpage_wareBusiness",
    "t": int(time.time() * 1e3),
}
response = requests.post(url, json=params)
h5st = response.json()['data']['h5st_now']
logger.info('h5st: %s' % (h5st))

headers = {

}
cookies = {

}
params.update({
    'h5st': h5st,
    "x-api-eid-token": "",
    "loginType": "",
    "scval": "",
    "uuid": ""
})

response = requests.get("https://api.m.jd.com/", headers=headers, cookies=cookies, params=params)
logger.info('==> %s' % (response.text))
